import HorizontalPlatform
import IntervalWorkingDevice
import pygame
image=pygame.image.load("trapdoor.jpg")
image.set_colorkey((137,44,75))
image_=pygame.image.load("trapdoor_.jpg")
image_.set_colorkey((137,44,75))

class TrapDoor(IntervalWorkingDevice.IntervalWorkingDevice, HorizontalPlatform.HorizontalPlatform):
	def __init__(self,pos=(0,0),im=image,im_=image_,intervals=(15,30),c_interval=0,c_time=1,off=False):
		HorizontalPlatform.HorizontalPlatform.__init__(self,pos,im)
		IntervalWorkingDevice.IntervalWorkingDevice.__init__(self,intervals=intervals,c_interval=c_interval,c_time=c_time,off=off)
		self.image_=im_
	def drawingInformation(self):
		if self.cur_interval==0:
			return self.pos,self.image_
		return self.pos,self.image

	'''def yLanding(self,objecto):
		x1=objecto.intermediate_x(self.pos[1])
		if self.within_x_boundary(x1,objecto.getWidth()) and (objecto.y<=self.pos[1]<=objecto.prev_y):
			objecto.y_bound=self
			objecto.rebound(x1,self.pos[1])
			self.boundedList.append(objecto)'''
	def within_x_boundary(self,ox,ow):
		return self.cur_interval==1 and HorizontalPlatform.HorizontalPlatform.within_x_boundary(self,ox,ow)
		#self.pos[0]<=ox and ox<=self.pos[0]+self.getWidth()